from flask import Blueprint, jsonify, request
import app.services.task_service as task_service
import app.models.task as task_model
import uuid

import requests
import json
import logging
from app.utils.AESC import AESCrypto_Yzdyh
import time

task_bp = Blueprint('task', __name__, url_prefix='/task')


@task_bp.route('/addTask', methods=['POST'])
def addTask():
    data = request.get_json()
    tast = task_model.Task(data)
    tast.id = str(uuid.uuid4().int)
    task_service.addTask(tast)
    return jsonify({"status": "success","data": ""})



@task_bp.route('/getTask', methods=['GET'])
def getTask():
    datas = task_service.getTasks();
    return jsonify({"status": "success","data": datas})
